package com.pactera.madp.cp.api.em.beta;

import lombok.AllArgsConstructor;
import lombok.Getter;
import org.springframework.util.Assert;

/**
 * @title 原创资讯类型定义
 * @date 2022-06-10
 * @author Deming.Chang
 */
@Getter
@AllArgsConstructor
public enum OriginalEnum {

    BURST_INTERPRETATION(1, "突发解读"),
    FINANCIAL_COMMERCIAL(2, "财商保典"),
    FUND_MANAGER_RESEARCH(3, " 基金经理研究"),        // 已废弃
    ASSET_ALLOCATION_SERIES(4, "资产配置系列 "),      // 已废弃
    MONTHLY_STRATEGY_REPORT (5, " 月度策略报告"),
    QUARTERLY_STRATEGY_REPORT(6, "季度策略报告"),
    FUND_STRATEGY_WEEKLY_REPORT(7, "基金策略周报"),
    HOTSPOT_FOCUS(8, "热点聚焦"),                    // 已废弃
    INSURANCE_WEEKLY(9, " 保险周记"),
    FINANCIAL_WEEK_CALENDAR(10, " 理财周历"),
    BASIC_KNOWLEDGE(11, " 有基知识"),
    THE_BASE_CANNOT_BE_LOST(12, "基不可失"),
    ASSET_ALLOCATION_WEEKLY(13, "资产配置周报"),
    ASSET_ALLOCATION_MONTHLY(14, "资产配置月报"),
    MACRO_INTERPRETATION(15, "宏观解读"),
    MARKET_INTERPRETATION(16, "市场解读"),
    FUND_INTERPRETATION(17, "基金解读"),
    ILLUSTRATION_OF_FINANCIAL_MANAGEMENT(18, "图说理财"),
    FINANCIAL_QUESTIONS_AND_ANSWERS(19, " 理财问答");

    private Integer type;    // 类型
    private String name;    // 名称

    /**
     * 根据类型数值获取枚举对象
     * @param type    原创资讯类型值
     * @return
     */
    public static OriginalEnum findByType(Integer type){
        Assert.notNull(type, "原创资讯类型值不能为空!");
        for(OriginalEnum enums: values()){
            if(enums.type == type){
                return enums;
            }
        }
        throw new IllegalArgumentException("参数异常,参数值不在允许的值范围之内!");
    }
}
